# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the terms described in the LICENSE file in
# the root directory of this source tree.

"""
Temporary ordering helpers extracted from origin/main client-sdks/stainless/openapi.yml.

These lists help the new generator match the previous ordering so that diffs
remain readable while we debug schema content regressions. Remove once stable.
"""

LEGACY_PATH_ORDER = [
    "/v1/batches",
    "/v1/batches/{batch_id}",
    "/v1/batches/{batch_id}/cancel",
    "/v1/chat/completions",
    "/v1/chat/completions/{completion_id}",
    "/v1/completions",
    "/v1/conversations",
    "/v1/conversations/{conversation_id}",
    "/v1/conversations/{conversation_id}/items",
    "/v1/conversations/{conversation_id}/items/{item_id}",
    "/v1/embeddings",
    "/v1/files",
    "/v1/files/{file_id}",
    "/v1/files/{file_id}/content",
    "/v1/health",
    "/v1/inspect/routes",
    "/v1/models",
    "/v1/models/{model_id}",
    "/v1/moderations",
    "/v1/prompts",
    "/v1/prompts/{prompt_id}",
    "/v1/prompts/{prompt_id}/set-default-version",
    "/v1/prompts/{prompt_id}/versions",
    "/v1/providers",
    "/v1/providers/{provider_id}",
    "/v1/responses",
    "/v1/responses/{response_id}",
    "/v1/responses/{response_id}/input_items",
    "/v1/safety/run-shield",
    "/v1/scoring-functions",
    "/v1/scoring-functions/{scoring_fn_id}",
    "/v1/scoring/score",
    "/v1/scoring/score-batch",
    "/v1/shields",
    "/v1/shields/{identifier}",
    "/v1/tool-runtime/invoke",
    "/v1/tool-runtime/list-tools",
    "/v1/toolgroups",
    "/v1/toolgroups/{toolgroup_id}",
    "/v1/tools",
    "/v1/tools/{tool_name}",
    "/v1/vector-io/insert",
    "/v1/vector-io/query",
    "/v1/vector_stores",
    "/v1/vector_stores/{vector_store_id}",
    "/v1/vector_stores/{vector_store_id}/file_batches",
    "/v1/vector_stores/{vector_store_id}/file_batches/{batch_id}",
    "/v1/vector_stores/{vector_store_id}/file_batches/{batch_id}/cancel",
    "/v1/vector_stores/{vector_store_id}/file_batches/{batch_id}/files",
    "/v1/vector_stores/{vector_store_id}/files",
    "/v1/vector_stores/{vector_store_id}/files/{file_id}",
    "/v1/vector_stores/{vector_store_id}/files/{file_id}/content",
    "/v1/vector_stores/{vector_store_id}/search",
    "/v1/version",
    "/v1beta/datasetio/append-rows/{dataset_id}",
    "/v1beta/datasetio/iterrows/{dataset_id}",
    "/v1beta/datasets",
    "/v1beta/datasets/{dataset_id}",
    "/v1alpha/eval/benchmarks",
    "/v1alpha/eval/benchmarks/{benchmark_id}",
    "/v1alpha/eval/benchmarks/{benchmark_id}/evaluations",
    "/v1alpha/eval/benchmarks/{benchmark_id}/jobs",
    "/v1alpha/eval/benchmarks/{benchmark_id}/jobs/{job_id}",
    "/v1alpha/eval/benchmarks/{benchmark_id}/jobs/{job_id}/result",
    "/v1alpha/inference/rerank",
    "/v1alpha/post-training/job/artifacts",
    "/v1alpha/post-training/job/cancel",
    "/v1alpha/post-training/job/status",
    "/v1alpha/post-training/jobs",
    "/v1alpha/post-training/preference-optimize",
    "/v1alpha/post-training/supervised-fine-tune",
]

LEGACY_SCHEMA_ORDER = [
    "Error",
    "ListBatchesResponse",
    "CreateBatchRequest",
    "Batch",
    "Order",
    "ListOpenAIChatCompletionResponse",
    "OpenAIAssistantMessageParam",
    "OpenAIChatCompletionContentPartImageParam",
    "OpenAIChatCompletionContentPartParam",
    "OpenAIChatCompletionContentPartTextParam",
    "OpenAIChatCompletionToolCall",
    "OpenAIChatCompletionToolCallFunction",
    "OpenAIChatCompletionUsage",
    "OpenAIChoice",
    "OpenAIChoiceLogprobs",
    "OpenAIDeveloperMessageParam",
    "OpenAIFile",
    "OpenAIFileFile",
    "OpenAIImageURL",
    "OpenAIMessageParam",
    "OpenAISystemMessageParam",
    "OpenAITokenLogProb",
    "OpenAIToolMessageParam",
    "OpenAITopLogProb",
    "OpenAIUserMessageParam",
    "OpenAIJSONSchema",
    "OpenAIResponseFormatJSONObject",
    "OpenAIResponseFormatJSONSchema",
    "OpenAIResponseFormatParam",
    "OpenAIResponseFormatText",
    "OpenAIChatCompletionRequestWithExtraBody",
    "OpenAIChatCompletion",
    "OpenAIChatCompletionChunk",
    "OpenAIChoiceDelta",
    "OpenAIChunkChoice",
    "OpenAICompletionWithInputMessages",
    "OpenAICompletionRequestWithExtraBody",
    "OpenAICompletion",
    "OpenAICompletionChoice",
    "ConversationItem",
    "OpenAIResponseAnnotationCitation",
    "OpenAIResponseAnnotationContainerFileCitation",
    "OpenAIResponseAnnotationFileCitation",
    "OpenAIResponseAnnotationFilePath",
    "OpenAIResponseAnnotations",
    "OpenAIResponseContentPartRefusal",
    "OpenAIResponseInputFunctionToolCallOutput",
    "OpenAIResponseInputMessageContent",
    "OpenAIResponseInputMessageContentFile",
    "OpenAIResponseInputMessageContentImage",
    "OpenAIResponseInputMessageContentText",
    "OpenAIResponseMCPApprovalRequest",
    "OpenAIResponseMCPApprovalResponse",
    "OpenAIResponseMessage",
    "OpenAIResponseOutputMessageContent",
    "OpenAIResponseOutputMessageContentOutputText",
    "OpenAIResponseOutputMessageFileSearchToolCall",
    "OpenAIResponseOutputMessageFunctionToolCall",
    "OpenAIResponseOutputMessageMCPCall",
    "OpenAIResponseOutputMessageMCPListTools",
    "OpenAIResponseOutputMessageWebSearchToolCall",
    "CreateConversationRequest",
    "Conversation",
    "UpdateConversationRequest",
    "ConversationDeletedResource",
    "ConversationItemList",
    "AddItemsRequest",
    "ConversationItemDeletedResource",
    "OpenAIEmbeddingsRequestWithExtraBody",
    "OpenAIEmbeddingData",
    "OpenAIEmbeddingUsage",
    "OpenAIEmbeddingsResponse",
    "OpenAIFilePurpose",
    "ListOpenAIFileResponse",
    "OpenAIFileObject",
    "ExpiresAfter",
    "OpenAIFileDeleteResponse",
    "Response",
    "HealthInfo",
    "RouteInfo",
    "ListRoutesResponse",
    "OpenAIModel",
    "OpenAIListModelsResponse",
    "Model",
    "ModelType",
    "RunModerationRequest",
    "ModerationObject",
    "ModerationObjectResults",
    "Prompt",
    "ListPromptsResponse",
    "CreatePromptRequest",
    "UpdatePromptRequest",
    "SetDefaultVersionRequest",
    "ProviderInfo",
    "ListProvidersResponse",
    "ListOpenAIResponseObject",
    "OpenAIResponseError",
    "OpenAIResponseInput",
    "OpenAIResponseInputToolFileSearch",
    "OpenAIResponseInputToolFunction",
    "OpenAIResponseInputToolWebSearch",
    "OpenAIResponseObjectWithInput",
    "OpenAIResponseOutput",
    "OpenAIResponsePrompt",
    "OpenAIResponseText",
    "OpenAIResponseTool",
    "OpenAIResponseToolMCP",
    "OpenAIResponseUsage",
    "ResponseGuardrailSpec",
    "OpenAIResponseInputTool",
    "OpenAIResponseInputToolMCP",
    "CreateOpenaiResponseRequest",
    "OpenAIResponseObject",
    "OpenAIResponseContentPartOutputText",
    "OpenAIResponseContentPartReasoningSummary",
    "OpenAIResponseContentPartReasoningText",
    "OpenAIResponseObjectStream",
    "OpenAIResponseObjectStreamResponseCompleted",
    "OpenAIResponseObjectStreamResponseContentPartAdded",
    "OpenAIResponseObjectStreamResponseContentPartDone",
    "OpenAIResponseObjectStreamResponseCreated",
    "OpenAIResponseObjectStreamResponseFailed",
    "OpenAIResponseObjectStreamResponseFileSearchCallCompleted",
    "OpenAIResponseObjectStreamResponseFileSearchCallInProgress",
    "OpenAIResponseObjectStreamResponseFileSearchCallSearching",
    "OpenAIResponseObjectStreamResponseFunctionCallArgumentsDelta",
    "OpenAIResponseObjectStreamResponseFunctionCallArgumentsDone",
    "OpenAIResponseObjectStreamResponseInProgress",
    "OpenAIResponseObjectStreamResponseIncomplete",
    "OpenAIResponseObjectStreamResponseMcpCallArgumentsDelta",
    "OpenAIResponseObjectStreamResponseMcpCallArgumentsDone",
    "OpenAIResponseObjectStreamResponseMcpCallCompleted",
    "OpenAIResponseObjectStreamResponseMcpCallFailed",
    "OpenAIResponseObjectStreamResponseMcpCallInProgress",
    "OpenAIResponseObjectStreamResponseMcpListToolsCompleted",
    "OpenAIResponseObjectStreamResponseMcpListToolsFailed",
    "OpenAIResponseObjectStreamResponseMcpListToolsInProgress",
    "OpenAIResponseObjectStreamResponseOutputItemAdded",
    "OpenAIResponseObjectStreamResponseOutputItemDone",
    "OpenAIResponseObjectStreamResponseOutputTextAnnotationAdded",
    "OpenAIResponseObjectStreamResponseOutputTextDelta",
    "OpenAIResponseObjectStreamResponseOutputTextDone",
    "OpenAIResponseObjectStreamResponseReasoningSummaryPartAdded",
    "OpenAIResponseObjectStreamResponseReasoningSummaryPartDone",
    "OpenAIResponseObjectStreamResponseReasoningSummaryTextDelta",
    "OpenAIResponseObjectStreamResponseReasoningSummaryTextDone",
    "OpenAIResponseObjectStreamResponseReasoningTextDelta",
    "OpenAIResponseObjectStreamResponseReasoningTextDone",
    "OpenAIResponseObjectStreamResponseRefusalDelta",
    "OpenAIResponseObjectStreamResponseRefusalDone",
    "OpenAIResponseObjectStreamResponseWebSearchCallCompleted",
    "OpenAIResponseObjectStreamResponseWebSearchCallInProgress",
    "OpenAIResponseObjectStreamResponseWebSearchCallSearching",
    "OpenAIDeleteResponseObject",
    "ListOpenAIResponseInputItem",
    "RunShieldRequest",
    "RunShieldResponse",
    "SafetyViolation",
    "ViolationLevel",
    "AggregationFunctionType",
    "ArrayType",
    "BasicScoringFnParams",
    "BooleanType",
    "ChatCompletionInputType",
    "CompletionInputType",
    "JsonType",
    "LLMAsJudgeScoringFnParams",
    "NumberType",
    "ObjectType",
    "RegexParserScoringFnParams",
    "ScoringFn",
    "ScoringFnParams",
    "ScoringFnParamsType",
    "StringType",
    "UnionType",
    "ListScoringFunctionsResponse",
    "ScoreRequest",
    "ScoreResponse",
    "ScoringResult",
    "ScoreBatchRequest",
    "ScoreBatchResponse",
    "Shield",
    "ListShieldsResponse",
    "InvokeToolRequest",
    "ImageContentItem",
    "InterleavedContent",
    "InterleavedContentItem",
    "TextContentItem",
    "ToolInvocationResult",
    "URL",
    "ToolDef",
    "ListToolDefsResponse",
    "ToolGroup",
    "ListToolGroupsResponse",
    "Chunk",
    "ChunkMetadata",
    "InsertChunksRequest",
    "QueryChunksRequest",
    "QueryChunksResponse",
    "VectorStoreFileCounts",
    "VectorStoreListResponse",
    "VectorStoreObject",
    "VectorStoreChunkingStrategy",
    "VectorStoreChunkingStrategyAuto",
    "VectorStoreChunkingStrategyStatic",
    "VectorStoreChunkingStrategyStaticConfig",
    "OpenAICreateVectorStoreRequestWithExtraBody",
    "OpenaiUpdateVectorStoreRequest",
    "VectorStoreDeleteResponse",
    "OpenAICreateVectorStoreFileBatchRequestWithExtraBody",
    "VectorStoreFileBatchObject",
    "VectorStoreFileStatus",
    "VectorStoreFileLastError",
    "VectorStoreFileObject",
    "VectorStoreFilesListInBatchResponse",
    "VectorStoreListFilesResponse",
    "OpenaiAttachFileToVectorStoreRequest",
    "OpenaiUpdateVectorStoreFileRequest",
    "VectorStoreFileDeleteResponse",
    "bool",
    "VectorStoreContent",
    "VectorStoreFileContentResponse",
    "OpenaiSearchVectorStoreRequest",
    "VectorStoreSearchResponse",
    "VectorStoreSearchResponsePage",
    "VersionInfo",
    "AppendRowsRequest",
    "PaginatedResponse",
    "Dataset",
    "RowsDataSource",
    "URIDataSource",
    "ListDatasetsResponse",
    "Benchmark",
    "ListBenchmarksResponse",
    "BenchmarkConfig",
    "GreedySamplingStrategy",
    "ModelCandidate",
    "SamplingParams",
    "SystemMessage",
    "TopKSamplingStrategy",
    "TopPSamplingStrategy",
    "EvaluateRowsRequest",
    "EvaluateResponse",
    "RunEvalRequest",
    "Job",
    "RerankRequest",
    "RerankData",
    "RerankResponse",
    "Checkpoint",
    "PostTrainingJobArtifactsResponse",
    "PostTrainingMetric",
    "CancelTrainingJobRequest",
    "PostTrainingJobStatusResponse",
    "ListPostTrainingJobsResponse",
    "DPOAlignmentConfig",
    "DPOLossType",
    "DataConfig",
    "DatasetFormat",
    "EfficiencyConfig",
    "OptimizerConfig",
    "OptimizerType",
    "TrainingConfig",
    "PreferenceOptimizeRequest",
    "PostTrainingJob",
    "AlgorithmConfig",
    "LoraFinetuningConfig",
    "QATFinetuningConfig",
    "SupervisedFineTuneRequest",
    "RegisterModelRequest",
    "ParamType",
    "RegisterScoringFunctionRequest",
    "RegisterShieldRequest",
    "RegisterToolGroupRequest",
    "DataSource",
    "RegisterDatasetRequest",
    "RegisterBenchmarkRequest",
]

LEGACY_RESPONSE_ORDER = ["BadRequest400", "TooManyRequests429", "InternalServerError500", "DefaultError"]

LEGACY_TAGS = [
    {
        "description": "APIs for creating and interacting with agentic systems.",
        "name": "Agents",
        "x-displayName": "Agents",
    },
    {
        "description": "The API is designed to allow use of openai client libraries for seamless integration.\n"
        "\n"
        "This API provides the following extensions:\n"
        " - idempotent batch creation\n"
        "\n"
        "Note: This API is currently under active development and may undergo changes.",
        "name": "Batches",
        "x-displayName": "The Batches API enables efficient processing of multiple requests in a single operation, "
        "particularly useful for processing large datasets, batch evaluation workflows, and cost-effective "
        "inference at scale.",
    },
    {"description": "", "name": "Benchmarks"},
    {
        "description": "Protocol for conversation management operations.",
        "name": "Conversations",
        "x-displayName": "Conversations",
    },
    {"description": "", "name": "DatasetIO"},
    {"description": "", "name": "Datasets"},
    {
        "description": "Llama Stack Evaluation API for running evaluations on model and agent candidates.",
        "name": "Eval",
        "x-displayName": "Evaluations",
    },
    {
        "description": "This API is used to upload documents that can be used with other Llama Stack APIs.",
        "name": "Files",
        "x-displayName": "Files",
    },
    {
        "description": "Llama Stack Inference API for generating completions, chat completions, and embeddings.\n"
        "\n"
        "This API provides the raw interface to the underlying models. Three kinds of models are supported:\n"
        '- LLM models: these models generate "raw" and "chat" (conversational) completions.\n'
        "- Embedding models: these models generate embeddings to be used for semantic search.\n"
        "- Rerank models: these models reorder the documents based on their relevance to a query.",
        "name": "Inference",
        "x-displayName": "Inference",
    },
    {
        "description": "APIs for inspecting the Llama Stack service, including health status, available API routes with "
        "methods and implementing providers.",
        "name": "Inspect",
        "x-displayName": "Inspect",
    },
    {"description": "", "name": "Models"},
    {"description": "", "name": "PostTraining (Coming Soon)"},
    {"description": "Protocol for prompt management operations.", "name": "Prompts", "x-displayName": "Prompts"},
    {
        "description": "Providers API for inspecting, listing, and modifying providers and their configurations.",
        "name": "Providers",
        "x-displayName": "Providers",
    },
    {"description": "OpenAI-compatible Moderations API.", "name": "Safety", "x-displayName": "Safety"},
    {"description": "", "name": "Scoring"},
    {"description": "", "name": "ScoringFunctions"},
    {"description": "", "name": "Shields"},
    {"description": "", "name": "ToolGroups"},
    {"description": "", "name": "ToolRuntime"},
    {"description": "", "name": "VectorIO"},
]

LEGACY_TAG_ORDER = [
    "Agents",
    "Batches",
    "Benchmarks",
    "Conversations",
    "DatasetIO",
    "Datasets",
    "Eval",
    "Files",
    "Inference",
    "Inspect",
    "Models",
    "PostTraining (Coming Soon)",
    "Prompts",
    "Providers",
    "Safety",
    "Scoring",
    "ScoringFunctions",
    "Shields",
    "ToolGroups",
    "ToolRuntime",
    "VectorIO",
]

LEGACY_TAG_GROUPS = [
    {
        "name": "Operations",
        "tags": [
            "Agents",
            "Batches",
            "Benchmarks",
            "Conversations",
            "DatasetIO",
            "Datasets",
            "Eval",
            "Files",
            "Inference",
            "Inspect",
            "Models",
            "PostTraining (Coming Soon)",
            "Prompts",
            "Providers",
            "Safety",
            "Scoring",
            "ScoringFunctions",
            "Shields",
            "ToolGroups",
            "ToolRuntime",
            "VectorIO",
        ],
    }
]

LEGACY_SECURITY = [{"Default": []}]

LEGACY_OPERATION_KEYS = [
    "responses",
    "tags",
    "summary",
    "description",
    "operationId",
    "parameters",
    "requestBody",
    "deprecated",
]
